package com.example.opengldemo;

import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.SeekBar;

import androidx.appcompat.app.AppCompatActivity;

import com.example.opengldemo._01_.MyTDView;
import com.example.opengldemo._026_._026_MySurfaceView;
import com.example.opengldemo._05_.MySurfaceView;
import com.example.opengldemo._06_._6MySurfaceView;
import com.example.opengldemo._07_texture._07_MyTextureSurfaceView;
import com.example.opengldemo.util.MatrixState;

public class MainActivity_07 extends AppCompatActivity {
    _07_MyTextureSurfaceView myTextureSurfaceView_07_ ;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_07); //跳转到相关界面
        LinearLayout ll = (LinearLayout) findViewById(R.id.main_liner);
        ll.addView(init_07_MySurView());
        findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((Button)view).setText(myTextureSurfaceView_07_.updateState2());

            }
        });
        findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((Button)view).setText(myTextureSurfaceView_07_.updateState3());

            }
        });
        findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((Button)view).setText(myTextureSurfaceView_07_.updateWrapS());

            }
        });
        findViewById(R.id.button4).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((Button)view).setText(myTextureSurfaceView_07_.updateWrapT());

            }
        });

    }



    public GLSurfaceView init_07_MySurView() {
        myTextureSurfaceView_07_ = new _07_MyTextureSurfaceView(this); //创建 MyTDView 类的对象
        myTextureSurfaceView_07_.requestFocus(); //获取焦点
        myTextureSurfaceView_07_.setFocusableInTouchMode(true); //设置为可触控
        return myTextureSurfaceView_07_;
    }


    @Override
    public void onResume() {
        super.onResume();
        myTextureSurfaceView_07_.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        myTextureSurfaceView_07_.onPause();
    }
}
